/*
 * @Author: windys
 * @Description: 
 * @Date: 2021-12-11 14:07:16
 */
export const resize = (app: any) => {
    app.directive('resize', {
        beforeMount(el: any, binding: any) {
            let width = '', height = '';
            function isReize() {
                const style = document.defaultView.getComputedStyle(el);
                if (width !== style.width || height !== style.height) {
                    binding.value();  // 关键
                }
                width = style.width;
                height = style.height;
            }
            el.__vueSetInterval__ = setInterval(isReize, 300);
        },
        unmounted(el: any) {
            clearInterval(el.__vueSetInterval__);

        }
    })
}